const {
    override,
    addDecoratorsLegacy,
    disableEsLint,
    addBundleVisualizer,
    addWebpackAlias,   //路径别名
    adjustWorkbox,
    fixBabelImports    //按需加载antd
  } = require("customize-cra");
  const path = require("path");

  module.exports = override(
     addDecoratorsLegacy(), //启动久的babel插件
     disableEsLint(),   //禁止eslint
    // addBundleVisualizer({}, true),
    //配置路径别名
    // addWebpackAlias({
    //     '@':path.resolve(__dirname, 'src'),
    //     components:path(__dirname, 'src/components'),
    //     assets: path.resolve(__dirname, 'src/assets')
    // }),
    fixBabelImports('import', {
        libraryName: 'antd',
        style: true
      }),
    (config) => { //暴露webpack的配置 config ,evn
       //config 就是webpack各种配置 entry等等
        // 去掉打包生产map 文件
        // config.devtool = config.mode === 'development' ? 'cheap-module-source-map' : false;
        if(process.env.NODE_ENV==="production") config.devtool=false;
        if(process.env.NODE_ENV!=="development") config.plugins = [...config.plugins,...myPlugin]
        // console.log(config.module.rules[2].oneOf)
        // return false
        return config
    }
  )  